import axios from "axios";

// export default function httpRequest(){

// }

let httpRequest = function(method,url,params,data){  //定义一个函数表达式
    return axios({
        url,
        method,
        baseURL:"/api",
        headers:{ "content-type": "application/json;charset=utf-8",},
        params,
        data,
        timeout:10000
    }).then(response => {
        return response.data  //获取响应结果的数据
    })
}

export default httpRequest;  //默认导出上面的函数